broker = "redis://redisdb:6379/1"  # 任务队列
backend = "redis://redisdb:6379/2"  # 结果存储


# 设置代理人broker
# BROKER_URL = broker
broker_url = broker
# 设置结果存储
result_backend = backend
# RESULT_BACKEND = backend
# CELERY_RESULT_BACKEND = backend
# 使用django_celery_beat插件用来动态配置任务
# CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"
# celery 的启动工作数量设置
CELERY_WORKER_CONCURRENCY = 20
# 非常重要,有些情况下可以防止死锁
CELERYD_FORCE_EXECV = True
# celery 的 worker 执行多少个任务后进行重启操作
CELERY_WORKER_MAX_TASKS_PER_CHILD = 100
# 关闭时区感知
DJANGO_CELERY_BEAT_TZ_AWARE = False
# celery beat配置（周期性任务设置）
CELERY_ENABLE_UTC = False
# 设置任务结果过期时间
# RESULT_EXPIRES = 60
result_expires = 60
# 指定时区，默认是 UTC, 6.0
TIMEZONE = "Asia/Shanghai"

CELERY_HIJACK_ROOT_LOGGER = False
# 开启重连
broker_connection_retry_on_startup = True
